package cn.edu.hpu.jie.util;

import java.io.IOException;
import java.util.Properties;

import org.apache.commons.dbcp.BasicDataSource;

public class TeacherDB<T> extends DBHelp<T> {
	
	private static BasicDataSource teacherBds = new BasicDataSource();
	
	static {
		Properties properties = new Properties();
		try {
			properties.load(DBHelp.class.getClassLoader().getResourceAsStream("vote_db.properties"));
		} catch (IOException e) {
			e.printStackTrace();
		}
		
		String driver = properties.getProperty("driver");
		String url = properties.getProperty("url");
		String username = properties.getProperty("username");
		String password = properties.getProperty("password");
		
		teacherBds.setDriverClassName(driver);
		teacherBds.setUrl(url);
		teacherBds.setUsername(username);
		teacherBds.setPassword(password);
		
		teacherBds.setInitialSize(5);
		teacherBds.setMaxWait(5000);
		teacherBds.setMaxActive(20);
		teacherBds.setMaxIdle(10);
	}
	
	public TeacherDB() {
		super(teacherBds);
	}

}
